import 'package:flutter/material.dart';

/// 系统AppBar Wrapper 修改返回图标样式
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
  final String title;
  final bool showBack;

  const CustomAppBar({
    super.key,
    required this.title,
    this.showBack = true,
  });

  @override
  Widget build(BuildContext context) {
    return AppBar(
      automaticallyImplyLeading: false,
      leading: showBack
          ? IconButton(
        icon: Icon(Icons.arrow_back_ios),  // 自定义返回图标
        onPressed: () {
          Navigator.of(context).pop();
        },
      )
          : null,
      title: Text(title),
    );
  }

  @override
  Size get preferredSize => Size.fromHeight(kToolbarHeight);
}